{template 'common/header'}
<style>
	.item{position:relative;display:block;float:left;border:1px #ddd solid;border-radius:5px;background-color:#fff;padding:5px;width:190px;margin:0 20px 20px 0; overflow:hidden;}
	.title{margin:5px auto;line-height:2em;}
	.item img{width:178px;height:270px; cursor:pointer;}
	.item-style:hover img{width:178px;height:270px;border:3px #009cd6 solid;padding:1px; }
	.title .fa{display:none}
</style>
<div class="main">
	<ul class="nav nav-tabs">
		<li {if $op=='list' || empty($op)}class="active"{/if}><a href="{php echo $this->createWebUrl('storemanage',array('op'=>'list'));}">店铺管理</a></li>
		<li {if $op=='edit' && empty($storex_bases['id'])}class="active"{/if}><a href="{php echo $this->createWebUrl('storemanage',array('op'=>'edit'));}">添加店铺</a></li>
		{if $op=='edit' && !empty($storex_bases['id'])}<li class="active"><a href="{php echo $this->createWebUrl('storemanage', array('op'=>'edit','id'=>$id));}">编辑店铺</a></li>{/if}
	</ul>
	<form action="" class="form-horizontal form" method="post" enctype="multipart/form-data" onsubmit="return formcheck()">
		<input type="hidden" name="id" value="{$storex_bases['id']}">
		<div class="panel panel-default">
			<div class="panel-heading">
				店铺基本信息
			</div>
			<div class="panel-body">
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">店铺类型</label>
					<div class="col-sm-9 col-xs-12">
						<label class="radio-inline">
							<input type="radio" name="store_type" value="1" {if $storex_bases['store_type'] == 1}checked{/if} onclick="$('#store_add_info').show();$('#distance_info').hide()"/>酒店
						</label>
						<label class="radio-inline">
							<input type="radio" name="store_type" value="0" {if $storex_bases['store_type'] == 0}checked{/if} onclick="$('#store_add_info').hide();$('#distance_info').show()"/>普通店铺
						</label>
						<span class='help-block'>店铺类型决定店铺的填写信息，慎重选择</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">排序</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" id="displayorder" name="displayorder"  class="form-control" value="{$storex_bases['displayorder']}">
						<span class='help-block'>数字越大排名越高</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">店铺名称</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="title" id="title"  class="form-control" value="{$storex_bases['title']}">
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">运营时间</label>
					<div class="col-sm-4 col-xs-6">
						{php echo tpl_form_field_clock('timestart', $storex_bases['timestart'])}
					</div>
					<div class="col-sm-4 col-xs-6">
						{php echo tpl_form_field_clock('timeend', $storex_bases['timeend'])}
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">LOGO/缩略图</label>
					<div class="col-sm-9 col-xs-12">
						{php echo tpl_form_field_image('thumb', $storex_bases['thumb'])}
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">首页图片</label>
					<div class="col-sm-9 col-xs-12">
						{php echo tpl_form_field_multi_image('thumbs', $storex_bases['thumbs'])}
						<span class='help-block'>图片尺寸 （750*1232）</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">详情页图片</label>
					<div class="col-sm-9 col-xs-12">
						{php echo tpl_form_field_multi_image('detail_thumbs', $storex_bases['detail_thumbs'])}
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">店铺电话</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" id="phone" name="phone"  class="form-control" value="{$storex_bases['phone']}">
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">店铺Email</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" id="mail" name="mail"  class="form-control" value="{$storex_bases['mail']}">
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">店铺地址</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" id="address" name="address"  class="form-control" value="{$storex_bases['address']}">
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">所在地区</label>
					<div class="col-sm-9 col-xs-12">
						{php echo tpl_form_field_district('district',array('province' => $storex_bases['location_p'],'city' => $storex_bases['location_c'],'district' => $storex_bases['location_a']))}
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">店铺坐标</label>
					<div class="col-sm-9 col-xs-12" style="padding-left:15px;">
						{php echo tpl_form_field_coordinate('baidumap',$storex_bases)}
					</div>
				</div>
				<div class="form-group">
					{if $storex_bases['store_type'] != 1}
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">配送距离</label>
					{else}
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">显示距离</label>
					{/if}
					<div class="col-sm-9 col-xs-12">
						<input type="text" id="distance" name="distance"  class="form-control" value="{$storex_bases['distance']}">
						<span class='help-block'>配送距离或者是搜索店铺显示的距离范围（单位：公里），0则不限距离</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">订单抵扣金额</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" id="max_replace" name="max_replace"  class="form-control" value="{$storex_bases['max_replace']}">
						<span class='help-block'>该店铺的订单最大可用积分抵扣的金额</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">店铺介绍</label>
					<div class="col-sm-9 col-xs-12">
						<textarea style="height:100px;" id="description" name="description" class="form-control" cols="60">{$storex_bases['description']}</textarea>
						<div class="help-block">用于正文内的详情</div>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">关于我们</label>
					<div class="col-sm-9 col-xs-12">
						{php echo tpl_ueditor('store_info', $storex_bases['store_info']);}
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">位置交通</label>
					<div class="col-sm-9 col-xs-12">
						<textarea style="height:100px;" id="traffic" name="traffic" class="form-control" cols="60">{$storex_bases['traffic']}</textarea>
						<div class="help-block">店铺位置交通说明(选填)</div>
					</div>
				</div> 
				<span {if $storex_bases['store_type'] != 1}style="display: none"{/if} id="store_add_info">
					<div class="form-group">
						<label class="col-xs-12 col-md-2 control-label">酒店设施</label>
						<div class="col-md-10" id="device-container" style="padding-left: 0px;">
							{loop $devices $key $device}
							<div class="col-sm-5" style="margin: 5px 0px;">
								<div class="input-group">
									<span class="input-group-addon">
										<input type="checkbox" name="show_device[{$key}]" value="1" {if $device['isshow'] > 0}checked{/if} aria-label="Checkbox for following text input">
			  						</span>
									<input type="text" name="device[{$key}]" class="form-control device-input" value="{$device['value']}" />
									<span class="input-group-btn">
										<button class="btn btn-default device-delete" type="button">删除</button>
									</span>
								</div>
							</div>
							{/loop}
							<div class="col-sm-5">
								<button type="button" id="add_device" class="btn btn-default"><i class="fa fa-plus"></i> 添加</button>
							</div>
						</div>
					</div>
				</span>
				{if $storex_bases['store_type'] != 1}
				<div class="form-group credit_pw_mode">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">提货方式</label>
					<div class="col-sm-9 col-xs-12">
						<label class='checkbox-inline'><input type="checkbox" name="pick_up_mode[self_lift]" value="1" {if !empty($storex_bases['pick_up_mode']) && $storex_bases['pick_up_mode']['self_lift'] == 1 } checked {/if}> 自提 </label>
						<label class='checkbox-inline'><input type="checkbox" name="pick_up_mode[express]" value="2" {if !empty($storex_bases['pick_up_mode']) && $storex_bases['pick_up_mode'][express] == 2 } checked {/if}> 配送 </label>
						<span class="help-block">选择提货方式后会在结算订单的时候选择提货方式，请根据店铺实际情况设置。</span>
					</div>
				</div>
				{/if}
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">状态</label>
					<div class="col-sm-9 col-xs-12">
						<label class="radio-inline">
							<input type="radio" name="status" value="1" {if $storex_bases['status'] == 1}checked{/if}/>显示
						</label>
						<label class="radio-inline">
							<input type="radio" name="status" value="0" {if $storex_bases['status'] == 0}checked{/if}/>隐藏
						</label>
						<span class='help-block'>手机前台是否显示</span>
					</div>
				</div>
			</div>
		</div>
		<div class="form-group col-sm-12">
			<input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
			<input type="hidden" name="token" value="{$_W['token']}" />
		</div>
	</form>
</div>
<script type="text/javascript">
	$("#add_device").click(function() {
		var index = $('.device-input').length;
		var html =
			'<div class="col-sm-5" style="margin: 5px 0px;">' +
				'<div class="input-group">' +
					'<span class="input-group-addon">' +
						'<input type="checkbox" name="show_device[' + index + ']" value="1" aria-label="Checkbox for following text input">' +
					'</span>' +
					'<input type="text" name="device[' + index + ']" class="form-control device-input" value="">' +
					'<span class="input-group-btn">' +
						'<button class="btn btn-default" type="button">删除</button>' +
					'</span>' +
				'</div>' +
			'</div>';

		$(this).parent().before(html);
	});

	$('.device-delete').click(function() {
		$(this).parent().parent().parent().remove();
	});


	function del_device(num) {
		$("#add_device_" + num).remove();
	}

	function formcheck() {
		if ($("#title").val().trim() == '') {
			Tip.focus("title", "请填写酒店名称!", "right");
			return false;
		}
		return true;
	}
</script>

{template 'common/footer'}